<template>
  <div class="right-bar">
    <div
      v-for="(b ,i) in barData"
      :key="i"
      class="bar-item"
    >
      <div class="row-one">
        <img :src="getIcon(b.ssTransducerName)">
        <span>{{ b.ssTransducerName }}</span>
      </div>
      <div>
        <span class="num">{{ b.transducerValue }}</span>
        <span class="unit-text">{{ b.ssAnalogUnit }}</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    barData: Array
  },
  data() {
    return {};
  },
  mounted() {
  },
  methods: {
    getIcon(val) {
      let iconUrl = '';
      if (val.includes('温度')) {
        iconUrl = 'b-1';
      } else if (val.includes('烟雾')) {
        iconUrl = 'b-2';
      } else if (val.includes('甲烷')) {
        iconUrl = 'b-3';
      } else if (val.includes('一氧化碳')) {
        iconUrl = 'b-4';
      } else if (val.includes('粉尘')) {
        iconUrl = 'b-5';
      } else if (val.includes('风筒')) {
        iconUrl = 'b-6';
      }
      return iconUrl ? require(`@/assets/img/excavation/${iconUrl}.png`) : '';
    }
  }
};
</script>
<style lang="scss" scoped>
// 环境监测
.right-bar{
  width: 6.25rem;
  .bar-item{
    background-color: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;

    height: 3.75rem;
    padding: 0.3125rem 0;
    margin-bottom: 0.625rem;

    font-size: $auxiliaryText;
    color: $light2Grey;
    border-radius: 0.25rem;
    .row-one{
      display: flex;
      align-items: center;
      img{
        width: 0.875rem;
        height: 0.875rem;
        margin-right: 0.3125rem;
      }
    }
    .num{
      font-size: $smallHeadingsText;
      color: $white;
    }
  }
}
</style>
